import React from 'react'
import { TabBar } from 'antd-mobile'
import { Route, Redirect } from "react-router-dom";

// 引入首页 找房  我的页面
import Index from "../index/index"
import Found from "../found"
import My from "../my"
class Home extends React.Component {
    constructor(props) {
        super(props)
        this.state = {
            hidden: false,
            fullScreen: false
        }

    }
    renderContent(pageText) {
        return <div>
            <div>{pageText}</div>
        </div>

    }
    render() {
        console.log(this.props);
        return (
            <div style={{ position: 'fixed', height: '100%', width: '100%', top: 0 }}>
                <Route exact path="/home"><Redirect to="/home/index"></Redirect></Route>
                <TabBar
                    unselectedTintColor="#949494"
                    tintColor="#33A3F4"
                    barTintColor="white"
                >
                    <TabBar.Item
                        title="首页"
                        key="Index"
                        icon={<div className="iconfont icon-ind" />
                        }
                        selectedIcon={<div className="iconfont icon-ind" />
                        }
                        selected={this.props.location.pathname === '/home/index'}
                        onPress={() => {
                            this.props.history.push("/home/index")
                        }}

                    >
                        <Route path="/home/index" component={Index}></Route>
                    </TabBar.Item>
                    <TabBar.Item
                        icon={
                            <div className="iconfont icon-findHouse" />
                        }
                        selectedIcon={
                            <div className="iconfont icon-findHouse" />
                        }
                        title="找房"
                        key="Found"
                        selected={this.props.location.pathname === '/home/found'}
                        onPress={() => {
                            this.props.history.push("/home/found")
                        }}

                    >
                        <Route path="/home/found" component={Found}></Route>
                    </TabBar.Item>
                    <TabBar.Item
                        icon={
                            <div className="iconfont icon-my" />
                        }
                        selectedIcon={
                            <div className="iconfont icon-my" />
                        }
                        title="我的"
                        key="My"
                        selected={this.props.location.pathname === '/home/my'}
                        onPress={() => {
                            this.props.history.push("/home/my")
                        }}
                    >
                        <Route path="/home/my" component={My}></Route>
                    </TabBar.Item>
                </TabBar>
            </div>
        );
    }
}

export default Home;